import {
    AfterContentChecked, AfterViewInit, Component, DoCheck, ElementRef, Input, OnDestroy, OnInit,
    ViewChild
} from '@angular/core';
import { ServerSocket } from '@core/services/ws.service';
import set = Reflect.set;

@Component({
  selector: 'app-c-bullet',
  templateUrl: './c-bullet.component.html',
  styleUrls: ['./c-bullet.component.less']
})
export class CBulletComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck, AfterContentChecked {

  @Input() data;
  @Input() socket;
  @ViewChild('box') box: ElementRef;
  constructor(public ws: ServerSocket) { }
  @Input() height;
  _answerList = [];
  @Input() answerList;

    ngDoCheck() {
        if (this.answerList) {
            for (let i = this._answerList.length; i < this.answerList.length; i++) {

                this._answerList.push({
                    answer: this.answerList[i].answer,
                    name: this.answerList[i].userName,
                    delay: Math.random() * 3,
                    top: this.height / 34 * Math.ceil(Math.random() * 34)
                });
            }
        }
    }

    ngAfterContentChecked() {
    }

    // time;
  ngOnInit() {
  }

  ngAfterViewInit() {

  }

  ngOnDestroy() {

  }

}
